<template>
	<view class="page">
		<fu-custom bgColor="bg-white" :isBack="true" :isBottom="true">
			<block slot="content">{{goods_id?'编辑商品':'添加商品'}}</block>
			<block slot="right"> <text class="" @tap='proviewGoods'>预览</text> </block>
		</fu-custom>
		<view class="margin-lr padding-top  solid-bottom padding-bottom ">
			<view class="flex align-center">
				<view class="text-333  text-lg">商品标题</view>
			</view>
			<view class=" radius-16  text-df margin-top">
				<input type="text" v-model="goods_title" maxlength="30" placeholder="请输入商品标题,如商品品牌+名字等"
					placeholder-class="text-bf text-df">
			</view>
		</view>
		<view class="padding">
			<view class="flex align-center justify-between w100">
				<view class="flex align-center">
					<view class="text-333  text-lg">商品封面图片 <text class="text-999 text-sm "
							style="font-weight: 400;">（请上传尺寸400*400像素的图片）</text> </view>
				</view>
				<view class=""> {{goods_img!=''?1:0}}/1 </view>
			</view>
			<view class=" radius-16  margin-top ">
				<view class="fu-block-160 relative">
					<text v-if="goods_img" @tap="goods_img = ''" class='text-white cuIcon-close position-absolute '
						style="position: absolute;z-index: 10;; right: 0;top: 0;padding: 3px 6px;background-color: rgba(0, 0, 0, 0.5)"></text>
					<image class=" fu-block-160" mode="aspectFit" @tap="soloChooseImage('goods_imgId','goods_img',false,false)"
						:src="goods_img ? goods_img :'/static/icon/camera.png'">
					</image>
				</view>
			</view>
		</view>
		<view class="padding">
			<view class="flex align-center justify-between w100">
				<view class="flex align-center">
					<view class="text-333  text-lg">商品视频 </view>
				</view>
				<view class=""> {{goods_video!=''?1:0}}/1 </view>
			</view>
			<view class=" radius-16  margin-top ">
				<view class="fu-block-160 relative">
					<text v-if="goods_video" @tap="goods_video = ''" class='text-white cuIcon-close position-absolute '
						style="position: absolute;z-index: 10;; right: 0;top: 0;padding: 3px 6px;background-color: rgba(0, 0, 0, 0.5)"></text>
					<image :src="goods_video_img" mode="aspectFill" class="fu-block-160" v-if="goods_video"></image>
					<!-- <video :src="goods_video" controls class="w85 height-160" v-if="goods_video"></video> -->
					<image class=" fu-block-160" mode="aspectFit" v-if="goods_video ==''" @tap="soloChooseVideo()"
						src="/static/icon/video.png">
					</image>
				</view>
				<view class="margin-top-sm" v-if="progress > 0">
					上传进度：{{progress}}%
				</view>
			</view>
		</view>
		<view class="padding">
			<view class="flex align-center justify-between w100">
				<view class="flex align-center">
					<view class="text-333  text-lg">商品轮播图 <text class="text-999 text-sm "
							style="font-weight: 400;">（请上传尺寸400*400像素的图片）</text> </view>
				</view>
				<view class=""> {{goods_bannerImages.length}}/9 </view>
			</view>
			<view class="   margin-top">
				<fu-upload col="4" max="9" v-if="isShow" @change="handleImageUpload" :defData="goods_bannerImages">
				</fu-upload>
			</view>
		</view>
		<view class="padding-tb padding-lr">
			<view class="flex align-center justify-between w100">
				<view class="flex align-center">
					<view class="text-333  text-lg">商品详情 </view>
				</view>
			</view>
			<view class=" margin-top">
				<fu-editor ref="editor" v-if="isShow" :htmlInfo="goods_body1" @ediIpt='ediIpt'></fu-editor>
			</view>
		</view>
		<view class="w100 bg-f8 height-20"> </view>
		<view class="after-item-wrap bg-white  ">
			<view class="after-item flex justify-between align-center padding-tb solid-bottom" @click="toGoodsInfo(0)">
				<view class="after_left text-111 text-lg text-weight-400">商品参数</view>
				<view class="after_right text-bf text-weight-400 text-lg">
					<!-- <text class="margin-right-xs" :class="goods_type?'text-333':'text-bf'">{{goods_type||'请选择' }}</text> -->
					<text class="cuIcon-right"></text>
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom" @click="toGoodsInfo(1)">
				<view class="after_left text-111 text-lg text-weight-400">包装清单</view>
				<view class="after_right text-bf text-weight-400 text-lg">
					<!-- <text class="margin-right-xs" :class="goods_type?'text-333':'text-bf'">{{goods_type||'请选择' }}</text> -->
					<text class="cuIcon-right"></text>
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom" @click="toAccessories">
				<view class="after_left text-111 text-lg text-weight-400">配件商品</view>
				<view class="after_right text-bf text-weight-400 text-lg">
					<!-- <text class="margin-right-xs" :class="goods_type?'text-333':'text-bf'">{{goods_type||'请选择' }}</text> -->
					<text class="cuIcon-right"></text>
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom" @click="toggleTab('plate')">
				<view class="after_left text-111 text-lg text-weight-400">平台分类</view>
				<view class="after_right text-bf text-weight-400 text-lg">
					<text class="margin-right-xs" :class="cate_name?'text-333':'text-bf'">{{cate_name||'请选择' }}</text>
					<text class="cuIcon-right"></text>
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom" @click="toggleTab('store')">
				<view class="after_left text-111 text-lg text-weight-400">店铺商品分类</view>
				<view class="after_right text-bf text-weight-400 text-lg">
					<text class="margin-right-xs"
						:class="goods_shop_category?'text-333':'text-bf'">{{goods_shop_category||'请选择' }}</text>
					<text class="cuIcon-right"></text>
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-df text-111 text-lg text-weight-400 flex align-center">商品货号 </view>
				<view class="flex align-center  text-weight-400 text-lg">
					<input type="text" placeholder="请输入商品货号" class="text-right" v-model="goods_sn" placeholder-class="text-bf"
						maxlength="18">
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom" @click="toggleTab('selector')">
				<view class="after_left text-111 text-lg text-weight-400">商品品牌</view>
				<view class="after_right text-bf text-weight-400 text-lg">
					<text class="margin-right-xs" :class="brand_name?'text-333':'text-bf'">{{brand_name||'请选择' }}</text>
					<text class="cuIcon-right"></text>
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-111 text-lg text-weight-400">是否上架</view>
				<view class="after_right text-bf text-weight-400 text-lg">
					<switch class="switch" :color="is_default?'#28ca43':'#bfbfbf'" @change="handleSwitch"
						:checked="is_default ? true : false" style="transform: scale(0.7);"></switch>
				</view>
			</view>
			<view class="after-item  padding-tb solid-bottom">
				<view class="">
					<view class="after_left text-111 text-lg text-weight-400">活动标签 </view>
					<view class="flex align-center justify-between margin-top">
						<view class="flex align-center  margin-right-sm" v-for="(item,index) in partList" :key='index'
							@tap='selectItem(item)'>
							<image src="/static/icon/select.png" mode="aspectFill" class="fu-block-32" v-if="item.selected"></image>
							<image src="/static/icon/white.png" mode="aspectFill" class="fu-block-32" v-else>
							</image>
							<text class="margin-left-xs">{{item.name}}</text>
						</view>
					</view>
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-df text-111 text-lg text-weight-400 flex align-center">
					<text class="margin-right-xs">成本价</text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(1)'></image>
				</view>
				<view class="flex align-center  text-weight-400 text-lg">
					<input type="digit" placeholder="请输入成本价(元)" class="text-right" v-model="cost_price"
						placeholder-class="text-bf" maxlength="8" @input="priceIpt">
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-111 flex align-center text-lg text-weight-400">
					<text class="margin-right-xs">售卖价</text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(2)'></image>

				</view>
				<view class="flex align-center  text-weight-400 text-lg">
					<input type="digit" placeholder="请输入售卖价(元)" class="text-right" v-model="goods_price"
						placeholder-class="text-bf" maxlength="8" @input="priceIpt">
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-111 flex align-center text-lg text-weight-400">
					<text class="margin-right-xs">主营价格</text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(3)'></image>
				</view>
				<!-- 根据成本价计算 -->
				<view class="flex align-center  text-weight-400 text-lg">{{priceInfo.main_business_price}} </view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-111 flex align-center text-lg text-weight-400">
					<text class="margin-right-xs">VIP价格 </text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(4)'></image>
				</view>
				<!-- 根据成本价计算 -->
				<view class="flex align-center  text-weight-400 text-lg">{{priceInfo.vip_price}} </view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-111 text-lg text-weight-400">
					总库存
				</view>
				<view class="flex align-center  text-weight-400 text-lg">
					<input type="number" placeholder="请输入商品总库存" class="text-right" v-model="goods_stock"
						placeholder-class="text-bf" maxlength="8" @input="stockIpt($event,0)">
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-111 text-lg text-weight-400">
					库存下限
				</view>
				<view class="flex align-center  text-weight-400 text-lg">
					<input type="number" placeholder="请输入库存下限值" class="text-right" v-model="stock_warning"
						placeholder-class="text-bf" maxlength="8" @input="stockIpt($event,1)">
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-111 flex align-center text-lg text-weight-400">
					<text class="margin-right-xs">商品属性 </text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(5)'></image>
				</view>
				<view class="after_right  text-weight-400 text-lg">
					<input type="text" placeholder="例如:1件5盒,一盒5个" class="text-right" v-model="attribute"
						placeholder-class="text-bf" maxlength="18">
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-111 flex align-center text-lg text-weight-400">
					<text class="margin-right-xs">最小起订量 </text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(6)'></image>
				</view>
				<view class="after_right  text-weight-400 text-lg">
					<view class="radius-8 padding-lr width-200 flex align-center  padding-tb-xs  bg-f8">
						<input type="digit" placeholder="请输入" v-model="min_reserve" maxlength="4" @input="minIpt" class=" text-df ">
						<text>个</text>
					</view>
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-111 flex align-center text-lg text-weight-400">
					<text class="margin-right-xs">商品限购 </text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(7)'></image>
				</view>
				<view class="after_right  text-weight-400 text-lg">
					<switch class="switch" :color="is_limit?'#28ca43':'#bfbfbf'" @change="handleSwitchLimit"
						:checked="is_limit ? true : false" style="transform: scale(0.7);"></switch>
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom" v-if='is_limit'>
				<view class="after_left text-111 flex align-center text-lg text-weight-400">
					限购数量
				</view>
				<view class="after_right  text-weight-400 text-lg">
					<uni-number-box :value="quota_num" :min="1" :disabledIpt='true' :max="10000" @change="setnumber"
						:stepL="min_reserve">
					</uni-number-box>
				</view>
			</view>
			<view class="after-item flex justify-between align-center padding-tb solid-bottom" v-if='is_limit'>
				<view class="after_left text-111 flex align-center text-lg text-weight-400">
					限购时间
				</view>
				<view class="after_right  text-weight-400 flex align-center text-lg" @tap="toggleTab('date')">
					<view :class="quota_date==''?'text-bf':'text-333'">{{quota_date||'请选择'}}</view>
					<text class="cuIcon-right text-999"></text>
				</view>
			</view>
		</view>
		<view class="w100 bg-f8 height-20"> </view>
		<view class="padding-lr padding-bottom-120">
			<view class="after-item flex justify-between align-center padding-tb solid-bottom">
				<view class="after_left text-111 flex align-center text-lg text-weight-400">
					<text class="margin-right-xs">区间价格/数量 </text>
					<image src="/static/icon/3.png" mode="aspectFill" class="fu-block-32" @tap='handleOpen(8)'></image>
				</view>
				<view class="after_right  text-weight-400 text-lg">
					<switch class="switch" :color="is_section?'#28ca43':'#bfbfbf'" @change="handleSwitchSelect"
						:checked="is_section ? true : false" style="transform: scale(0.7);"></switch>
				</view>
			</view>
			<view class="" v-for="(item,index) in section_data" :key='index' v-if="is_section">
				<view class="after-item flex justify-between align-center padding-top ">
					<view class="after_left text-333 flex align-center text-bold text-df ">
						<text class="margin-right-xs">{{item.name}} </text>
					</view>
				</view>
				<view class="after-item flex justify-between align-center padding-tb ">
					<view class="after_left text-333 flex align-center text-df text-weight-400">
						<text class="margin-right-xs">阶梯价格</text>
					</view>
					<view class="flex align-center  text-weight-400 text-df">
						<input type="digit" placeholder="请输入阶梯价格(元)" class="text-right text-df" v-model="item.price"
							placeholder-class="text-bf" maxlength="8" @input="priceIpt1">
					</view>
				</view>
				<view class="after-item flex justify-between align-center padding-bottom solid-bottom">
					<view class="after_left margin-right-40 text-333 flex-shrink flex align-center text-df text-weight-400">
						<text class="margin-right-xs ">购买数量</text>
					</view>
					<view class="flex align-center   text-df">
						<view class="radius-8 padding-lr width-200 text-center padding-tb-xs  bg-f8">
							<input type="digit" placeholder="最小购买量" v-model="item.min" maxlength="4" class=" text-df ">
						</view>
						<text class="margin-lr-sm text-999">-</text>
						<view class="radius-8 padding-lr width-200 text-center padding-tb-xs  bg-f8">
							<input type="digit" placeholder="最大购买量" v-model="item.max" maxlength="7" class=" text-df ">
						</view>
					</view>
				</view>
			</view>
		</view>

		<view class="ben-btn submit-btn" @click.stop="handleSubmit">立即发布</view>
		<fu-notwork></fu-notwork>
		<!--品牌选择  -->
		<w-picker :visible.sync="brandVisible" mode="selector" value="" default-type="name" themeColor="#FF6464"
			:default-props="defaultProps" :options="brandList" @confirm="onConfirm($event,'brand')" ref="selector">
		</w-picker>

		<!-- 二级联动 店铺商品分类 -->
		<w-picker :visible.sync="storeVisible" mode="linkage" :options="storeTypeList" :level="2" themeColor="#FF6464"
			default-type="id" @confirm="onConfirm($event,'store')" ref="store">
		</w-picker>
		<!-- 三级联动 平台分类 -->
		<w-picker :visible.sync="typeVisible" mode="linkage" :options="typeList" :level="3" themeColor="#FF6464"
			default-type="id" @confirm="onConfirm($event,'plate')" ref="plate">
		</w-picker>
		<!-- 选择时间 -->
		<w-picker :visible.sync="timeVisible" mode="date" fields="day" themeColor="#FF6464" :startYear="startYear"
				:endYear="endYear"
			@confirm="onConfirm($event, 'date')" ref="date">限购时间</w-picker>
		<!-- 选择城市 start -->
		<w-picker :visible.sync="cityVisible" mode="region" :value="defaultVal" themeColor="#FF6464" default-type="value"
			:hide-area="false" @confirm="onConfirm($event, 'region')" ref="region"></w-picker>

		<!-- 规则说明 -->
		<fu-popup ref="coupon" mode="center" width="550rpx" height="700rpx" border-radius="8" :mask-close-able="true"
			v-model="couponModel" @close="handleClose">
			<view class="rule-box">
				<view class="rule-box-title solid-bottom">
					{{ruleTitle}}规则说明
				</view>
				<scroll-view class="rule-box-content" scroll-y>
					<jyf-parser :html="rulers"></jyf-parser>
				</scroll-view>
				<view class="rule-box-close solid-top" @click="handleClose">
					{{i18n['关闭']}}
				</view>
			</view>
		</fu-popup>
		<!-- 选择城市 end -->
		<fu-popup v-model="reasonPop" mode="center" border-radius="32" :mask-close-able="false">
			<view class="update-box padding">
				<view class="title text-bold">请输入原因</view>
				<view class="content bg-f8 radius-16 padding-sm ">
					<textarea class="w100 height-120
					" v-model="otherReason" maxlength="10"></textarea>
					<view class="text-right text-999 text-sm padding-top-sm">{{otherReason.length}}/10</view>
				</view>

				<view class="foot algin-center justify-around margin-top">
					<view class=" bg-f6 te-333 radius-100 padding-lr-60 padding-tb-16" @click="reasonPop=false">取消
					</view>
					<view class=" bg-fd2 text-white  radius-100 padding-lr-60 padding-tb-16" @click="handleConfirm">确认
					</view>
				</view>
			</view>
		</fu-popup>
	</view>
</template>

<script>
	import {
		UploadImage,
		UploadFileToOSS
	} from '@/common/utils/index';
	import {
		UPLOAD_IMAGE_URL
	} from '@/common/config.js';
	import FuUpload from '@/components/fu-upload/fu-upload.vue';
	// @see 引入组件wPicker
	import wPicker from "@/components/w-picker/w-picker.vue";
	import fuEditor from '@/components/fu-editor/fu-editor.vue';
	import OSSUtil from '@/common/oss/ossUtil.js'
	import md5 from '@/common/oss/md5.js'
	var date = new Date();
	  var y = Number(date.getFullYear());
	  var m = Number(date.getMonth() + 1);
	  var d = Number(date.getDate());
	  if (m < 10) {
	    m = '0' + m
	  }
	  if (d < 10) {
	    d = '0' + d
	  }

	export default {
		components: {
			FuUpload,
			wPicker,
			fuEditor
		},
		data() {
			return {
				startYear:y,
				endYear:(y+15),
				goods_id: 0, // 商品id
				imgWechatUrl: this.imgWechatUrl,
				order_sn: null, // 订单编号
				num: 0, // 商品数量
				images: [],
				isShow: false, //是否展示
				is_default: false, // 是否设为默认上架
				is_limit: true, //是否限购
				is_section: false, //是否开启价格区间
				goods_video: '', //商品视频
				goods_video_img: '', //视频第一帧
				goods_title: '', //标题
				goods_desc: '', //简介
				goods_img: '', //封面图
				goods_imgId: '', //
				goods_body: '', //商品详情
				goods_body1: '',
				goods_bannerImages: [], //轮播图
				stock_warning: '', //库存下限
				goods_images: [], //详情图
				cate_name: '', //平台分类
				goods_cid: '', //平台分类id
				goods_shop_category: '', //店铺分类
				goods_shop_categoryId: '', //店铺分类id
				params: [], //商品参数
				packing: [], //包装清单
				parts_ids: [], //配件商品ID
				goods_sn: '', //商品货号
				typeList: [], //商品类型
				storeTypeList: [], //店铺商品分类
				quota_date: '', //限购时间
				goods_price: '', //
				cost_price: '', //成本价
				quota_num: 1, //限购数量
				goods_address: '',
				province: '', //省
				city: '', //市
				district: '', //区
				progress: '', //上传视频进度
				goods_day: '', //试用天数
				goods_biness: '', //生产厂商
				goods_binessId: '', //生产厂商
				goods_express: '', //运费
				goods_num: '', //数量
				brand_name: '', //品牌
				brand_id: '', //品牌id
				goods_stock: '', //库存
				min_reserve: 1, //最小起订量
				attribute: '', //商品属性
				selectId: 1, //活动标签 1 新品 2爆品 3推荐 4发现
				partList: [{
					name: '新品',
					id: 1
				}, {
					name: '爆品',
					id: 2
				}, {
					name: '大咖推荐',
					id: 3
				}, {
					name: '发现',
					id: 4
				}],
				defaultVal: [1, 0, 0], // {Array} 城市编码
				cityVisible: false, // {Boolean} 组件wPicker是否显示
				brandVisible: false,
				typeVisible: false, //平台分类
				storeVisible: false, //店铺分类
				timeVisible: false,
				defaultProps: {
					"label": "name",
					"value": "id",
				},
				defaultProps1: {
					"label": "name",
					"value": "id",
					"children": "child"
				},
				refundInfo: '',
				select_reason: 0,
				images: [],
				refund_content: '', // 退款说明
				visible: false,
				refund_reason: [], //售后原因
				brandList: [], //品牌列表
				express_price: 0,
				isLoading: false, // 防连点
				reasonPop: false, //原因弹框
				otherReason: '', //其他原因
				select_reason_name: '', //选择的原因
				priceInfo: {}, //计算的价格信息
				parts_goods_ids: [], //配件商品id
				section_data: [{
					min: '',
					max: '',
					price: '',
					name: '第一阶梯'
				}, {
					min: '',
					max: '',
					price: '',
					name: '第二阶梯'
				}, {
					min: '',
					max: '',
					price: '',
					name: '第三阶梯'
				}],
				couponModel: false,
				ruleInfo: '', //规则
				rulers: '', //规则
				ruleTitle: '', //标题
				parent_goods_id: 0, //添加子商品的主商品id
			};
		},
		onLoad(options) {
			const {
				goods_id,
				parent_goods_id
			} = options;
			if (goods_id) {
				this.goods_id = goods_id || 0;
				this.getData();
			}
			if (parent_goods_id) {
				this.parent_goods_id = parent_goods_id
			}
			this.getTypeList()
			this.getBusinessTypeList()
			this.getBrandList()
			this.getRuleInfo()
			setTimeout(() => {
				this.isShow = true
			}, 300)
			uni.$on('goodsInfo', data => {
				console.log(data, '商品参数');
				this.params = data
			})
			uni.$on('packInfo', data => {
				console.log(data, '包装清单');
				this.packing = data
			})
			uni.$on('accessInfo', data => {
				console.log(data, '配件商品 id');
				this.parts_goods_ids = data
			})

		},
		watch: {},
		onUnload() {
			uni.$off('goodsInfo')
			uni.$off('packInfo')
			uni.$off('accessInfo')
		},
		methods: {
			handleClose() {
				this.couponModel = false;
			},
			handleOpen(e) {
				if (e == 1) { //成本价
					this.rulers = this.ruleInfo.cost_price_tip
					this.ruleTitle = '成本价'
				} else if (e == 2) { //售卖价
					this.rulers = this.ruleInfo.shop_price_tip
					this.ruleTitle = '售卖价'
				} else if (e == 3) { //主营价格
					this.rulers = this.ruleInfo.main_business_price_tip
					this.ruleTitle = '主营价格'
				} else if (e == 4) { //vip价格
					this.rulers = this.ruleInfo.vip_price_tip
					this.ruleTitle = 'vip价格'
				} else if (e == 5) { //商品属性
					this.rulers = this.ruleInfo.attribute_tip
					this.ruleTitle = '商品属性'
				} else if (e == 6) { //最小起订量
					this.rulers = this.ruleInfo.min_reserve_tip
					this.ruleTitle = '最小起订量'
				} else if (e == 7) { //商品限购
					this.rulers = this.ruleInfo.quota_tip
					this.ruleTitle = '商品限购'
				} else if (e == 8) { //区间价
					this.rulers = this.ruleInfo.section_tip
					this.ruleTitle = '区间价'
				}

				this.couponModel = true;
			},
			// 预览商品详情
			proviewGoods() {
				let data = {
					name: this.goods_title,
					cid_name: this.cate_name, //平台分类
					cid: this.goods_cid||0, //平台分类
					goods_shop_category: this.goods_shop_categoryId, //店铺分类id
					goods_shop_category_name: this.goods_shop_category, //店铺分类
					brand_id: this.brand_id,
					brand_name: this.brand_name,
					thumb_url: this.goods_img, //商品主图
					thumb: this.goods_imgId, //商品主图id
					stock: this.goods_stock,
					body: this.goods_body1,
					video: this.goods_video, //mp4
					stock_warning: this.stock_warning, //库存下限
					is_sale: this.is_default ? 1 : 0, //是否上架
					params: JSON.stringify(this.params), //商品参数 json {\"title\":\"重量\", \"value\":\"500G\"}
					packing: JSON.stringify(this.packing), //包装清单 json {\"title\":\"充电器\", \"value\":\"500W\"}
					parts_ids: JSON.stringify(this.parts_ids), //配件商品ids
					sn: this.goods_sn, //商品货号
					is_new: this.partList[0].selected ? 1 : 0, //是否新品
					is_hot: this.partList[1].selected ? 1 : 0, //是否爆品
					is_recommend: this.partList[2].selected ? 1 : 0, //是否推荐
					is_find: this.partList[3].selected ? 1 : 0, //是否发现商品
					is_quota: this.is_limit ? 1 : 0, //是否限购					
					section_data: this.section_data, //区间价格设置 {\"min\":10,\"max\":50,\"price\":95}
					attribute: this.attribute, //商品属性
					parts_goods_ids: JSON.stringify(this.parts_goods_ids)
				}
				data.images_url = this.goods_bannerImages.map(item => {
					return item.path
				}) //轮播图 
				data.goods_price = {
					shop_price: this.goods_price,
					vip: this.priceInfo.vip_rate,
					cost_price: this.cost_price,
					vip: this.priceInfo.vip_rate,
					vip: this.priceInfo.vip_rate,
					min_reserve: this.min_reserve, //最小起订量
					is_quota: this.is_limit ? 1 : 0, //是否限购
					quota_num: this.quota_num, //限购数量
					quota_date: this.quota_date, //限购时间
					is_section: this.is_section ? 1 : 0, //区间价格开关
				}

				this.$urouter.navigateTo({
					url: '/pages/goods/goodsdetail/goods-detail/index',
					params: {
						data: JSON.stringify(data),
						pageType: 'proview'
					}
				});
			},
			// 商品参数
			toGoodsInfo(e) {
				let data = []
				if (this.params.length > 0 || this.packing.length > 0) {
					data = (e == 0 ? JSON.stringify(this.params) : JSON.stringify(this.packing))
				}
				this.$urouter.navigateTo({
					url: './goodsInfo',
					params: {
						pageType: e == 0 ? 'goods' : 'list',
						data: data
					}
				});
			},
			// 配件商品
			toAccessories() {
				this.$urouter.navigateTo({
					url: './accessories',
					params: {
						pageType: 'public',
						goodsIds: JSON.stringify(this.parts_goods_ids)
					}
				});
			},
			chooseCity() {
				this.$urouter.navigateTo({
					url: '/pages/user/myPublic/position',
					params: {
						city: this.city,
						pageType: 'public'
					}
				});
			},
			ediIpt(e) {
				// console.log(e,'eeeeeeee');
				this.goods_body = e
			},

			selectItem(item) {
				item.selected = !item.selected
				this.$forceUpdate()
			},
			// 计算价格 63dcbe3998e18
			countPrice() {
				this.$api.post('/v1/63dcbe3998e18', {
					shop_price: this.goods_price,
					cost_price: this.cost_price
				}).then(res => {
					let data = res.data.data;
					this.priceInfo = data
					this.section_data[0].price = data.ladder1_price
					this.section_data[0].min = data.ladder1_num_min
					this.section_data[0].max = data.ladder1_num_max
					this.section_data[1].price = data.ladder2_price
					this.section_data[1].min = data.ladder2_num_min
					this.section_data[1].max = data.ladder2_num_max
					this.section_data[2].price = data.ladder3_price
					this.section_data[2].min = data.ladder3_num_min
					this.section_data[2].max = data.ladder3_num_max

				}).catch(err => {
					this.$message.info("服务器错误，请稍后重试");
				});
			},
			/**
			 * @func 切换是否上架
			 */
			handleSwitch(e) {
				this.is_default = e.detail.value;
			},
			// 商品限购
			handleSwitchLimit(e) {
				this.is_limit = e.detail.value;
				if (this.is_limit&&this.is_section) this.is_section = false
				// if (!this.is_limit) this.is_section = true
			},
			// 区间价
			handleSwitchSelect(e) {
				this.is_section = e.detail.value;
				if (this.is_section&&this.is_limit) this.is_limit = false
				// if (!this.is_section) this.is_limit = true
			},
			// 接口获取签名
			get_sign(filemd5, filesize, filename) {
				return new Promise((resolve, reject) => {
					this.$api.post('/v1/645318478d7ac', {
						// filemd5: filemd5,
						// filesize: filesize,
						filename: filename
					}).then(res => {
						if (res.data.code == 1) {
							resolve(res.data.data.aliyunData)
						} else {

						}
					})
				})
			},
			// 上传视频
			async soloChooseVideo() {
				let that = this

				let imageSrc = await OSSUtil.getVideo();
				let sign = await OSSUtil.get_STS()
				let fileName = OSSUtil.getFileName(imageSrc);
				let filemd5 = md5(fileName);
				let data = await this.get_sign(filemd5, sign.filesize, fileName);
				uni.showLoading({
					title: '上传中...',
					mask: true
				});
				console.log(sign.host, 'sign.host');
				let uploadTask = uni.uploadFile({
					url: sign.host,
					filePath: imageSrc,
					fileType: 'video',
					name: 'file',
					formData: {
						'key': data.key,
						'policy': data.policy,
						'OSSAccessKeyId': data.OSSAccessKeyId,
						'success_action_status': '200', //让服务端返回200,不然，默认会返回204
						'signature': data.signature,
					},
					success: (res) => {
						if (res.statusCode == 200) {
							uni.showToast({
								title: '上传成功',
								icon: 'none',
								duration: 1000
							});
							this.goods_video = sign.host + '/' + data.key;
							this.goods_video_img = this.goods_video +	'?x-oss-process=video/snapshot,t_10000,f_jpg,w_800,h_600,m_fast';
							console.log(this.goods_video_img, 'this.goods_video_img');
						};
					},
					fail: (err) => {
						uni.showModal({
							content: err.errMsg,
							showCancel: false
						});
					},
					complete: () => {
						uni.hideLoading()
					}
				});
				uploadTask.onProgressUpdate((res) => {
					// this.$Common.toast('上传进度'+res.progress+'%')
					this.progress = res.progress;
				});
			},
			//上传单图方法
			soloChooseImage(id, path, obj, obj1, fnName = false) {
				let self = this;
				if (!obj) obj = this;
				if (!obj1) obj1 = this;
				if (self.uploading) {
					return;
				}
				// 从相册中选择图片
				uni.chooseImage({
					count: 1, // 默认3
					sizeType: ["original", "compressed"], // 可以指定是原图还是压缩图，默认二者都有
					success: function(res) {
						const tempFilePaths = res.tempFilePaths;
						self.uploading = true;
						// 开始上传
						new UploadImage(tempFilePaths, {
							complete: function(res) {
								self.uploading = false;
								if (id) self.$set(obj, id, res[0].id);
								if (path) self.$set(obj1, path, res[0].path);
								if (fnName) self[fnName]()
							},
						});
					},
				});
			},
			priceIpt(e) {
				let num1 = e.detail.value
				if (num1.split('.') && num1.split('.')[1] && num1.split('.')[1].length > 2) {
					// this.goods_price = ''
					this.$message.info("请输入正确的金额");
				}
				if (num1 > 100000) {
					// this.goods_price = ''
					this.$message.info("最大价格不能超过10万");
				}
				if (this.goods_price && this.cost_price) {
					this.countPrice()
				}
			},
			priceIpt1(e){
				let num1 = e.detail.value
				if (num1.split('.') && num1.split('.')[1] && num1.split('.')[1].length > 2) {
					// this.goods_price = ''
					this.$message.info("请输入正确的金额");
				}
				if (num1 > 1000000) {
					// this.goods_price = ''
					this.$message.info("最大价格不能超过100万");
				}				
			},
			stockIpt(e, type) {
				let num2 = e.detail.value
				if (num2 <= 0 || num2 % 1 > 0) {
					if (type == 0) this.goods_stock = ''
					if (type == 1) this.stock_warning = ''
					this.$message.info("请输入正确的库存");
				}

			},
			// 最小起订量
			minIpt(e) {
				let num2 = e.detail.value
				if (num2 % 1 != 0) {
					this.min_reserve = 1
					return this.$message.info('起订量不能输入小数')
				}
				if (num2 <= 0) {
					this.min_reserve = 1
					return this.$message.info('请输入正确的起订量')
				}
				this.quota_num = e.detail.value
			},
			/**
			 * @event
			 * @description 所在地的选择弹窗显示
			 */
			toggleTab(ref) {
				this.$refs[ref].show();
			},
			// 获取弹框说明 63db2e1c80e82
			getRuleInfo() {
				this.$api.post('/v1/63db2e1c80e82').then(res => {
					let data = res.data;
					if (data.code == 1) {
						this.ruleInfo = data.data;
					} else {
						this.$message.info(res.data.msg);
					}
				}).catch(err => {
					this.$message.info("服务器错误，请稍后重试");
				});
			},
			/**
			 * @description 获取商品分类  三级
			 */
			getTypeList() {
				this.$api.post('/v1/5da6e49d7373a', {
					max_level: 1
				}).then(res => {
					let data = res.data;
					let list = []
					if (data.code == 1) {
						data.data.map(i => {
							if (i.child) {
								let a = i.child.filter(k => {
									return k.child
								})
								i.child = a
							}
						})
						list = data.data.filter(i => {
							return i.child && i.child.length > 0
						})
						list.map((item, index) => {
							item.label = item.name
							item.value = item.id
							item.children = item.child
							if (item && item.children && item.children.length > 0) {
								item.children.map((item1, index1) => {
									item1.label = item1.name
									item1.value = item1.id
									item1.children = item1.child
									if (item1 && item1.children && item1.children.length > 0) {
										item1.children.map((item2, index2) => {
											item2.label = item2.name
											item2.value = item2.id
											item2.children = item2.child
										})
									}
								})
							}
						})
						this.typeList = list
					} else {
						this.$message.info(res.data.msg);
					}
				}).catch(err => {
					console.log(err, 'err');
					this.$message.info("服务器错误，请稍后重试");
				});
			},
			// 店铺商品分类 二级
			getBusinessTypeList() {
				this.$api.post('/v1/6356329f1f82a', {
					partner_id: global.userInfo && global.userInfo.id
				}).then(res => {
					let data = res.data;
					if (data.code == 1) {
						if (data.data.length == 0) {
							this.$message.info('请先添加分类')
							setTimeout(() => {
								uni.navigateBack()
							}, 800)
						} else {
							data.data.map(item => {
								item.label = item.name
								item.value = item.id
								item.children = item.child
								if (item.child_count > 0) {
									item.children.map(item1 => {
										item1.label = item1.name
										item1.value = item1.id
										item1.children = item1.child
									})
								}
							})
							let list = data.data;
							// 判断没有二级分类删除此分类
							list.forEach((item, index) => {
								if (item.child_count <= 0) {
									list.splice(index, 1);
								}
							});
							this.storeTypeList = list
						}

					} else {
						this.$message.info(res.data.msg);
					}
				}).catch(err => {
					this.$message.info("服务器错误，请稍后重试");
				});
			},

			/**
			 * @description 获取品牌
			 */
			getBrandList() {
				this.$api.post('/v1/5fd03fb587fcb').then(res => {
					let data = res.data;
					if (data.code == 1) {
						data.data.map(item => {
							item.label = item.name
							item.value = item.id
						})
						this.brandList = data.data;
					} else {
						this.$message.info(res.data.msg);
					}
				}).catch(err => {
					this.$message.info("服务器错误，请稍后重试");
				});
			},
			/**
			 * @event
			 * @description 所在地选择事件
			 * @param {Object} result - 用户所在地弹窗选择的值
			 */
			onConfirm(result, type) {
				console.log(result, type);
				let a1=result.obj.col1&&result.obj.col1.name
				let a2=result.obj.col2&&result.obj.col2.name
				let a3=result.obj.col3&&result.obj.col3.name
				if (type == 'brand') {
					this.brand_name = result.result
					this.brand_id = result.value
				}
				if (type == 'store') {
					this.goods_shop_category = a1+'-'+a2
					this.goods_shop_categoryId = result.value[1]
				}
				if (type == 'plate') {
					this.cate_name = a1+'-'+a2+'-'+a3
					this.goods_cid = result.value[1]
				}
				if (type == 'date') {
					this.quota_date = result.value;
					const date = new Date(this.quota_date+' 23:59:59');
					const nowDate = new Date();
					const timestamp = date.getTime();
					const timestamp1 = nowDate.getTime();
					// console.log(date,nowDate,timestamp,timestamp1,'timestamp1');
					if(timestamp<timestamp1){
						return this.$message.info('请选择今日及之后的时间')
					}
				}

			},
			// 设置数量
			setnumber(e) {
				console.log(e,'============数量');
				this.quota_num = e;
			},
			handleConfirm() {
				this.reasonPop = false
				this.select_reason_name = this.otherReason
			},
			//获取商品信息
			getData() {
				let data = {
					goods_id: this.goods_id,
				};
				this.$api.post('/v1/63db88bfa642a', data).then(res => {
					if (res.data.code == 1) {
						let data1 = res.data.data;
						this.goods_title = data1.name
						this.goods_desc = data1.description
						this.goods_img = data1.thumb_url
						this.goods_imgId = data1.thumb
						this.goods_num = data1.stock
						this.cate_name = data1.cid_name
						this.goods_cid = data1.cid
						this.goods_shop_categoryId = data1.goods_shop_category
						this.goods_shop_category = data1.goods_shop_category_name
						this.brand_name = data1.brand_name
						this.brand_id = data1.brand_id
						this.goods_sn = data1.sn
						this.goods_video=data1.video_url
						this.goods_video_img=data1.video_url+	'?x-oss-process=video/snapshot,t_10000,f_jpg,w_800,h_600,m_fast'
						if (data1.goods_price) {
							this.goods_price = data1.goods_price.shop_price
							this.cost_price = data1.goods_price.cost_price
							this.priceInfo.vip_rate = data1.goods_price.vip
							this.priceInfo.vip_price = data1.goods_price.vip
							
							this.priceInfo.main_business_price = data1.goods_price.main_business
							this.min_reserve = data1.goods_price.min_reserve
							this.quota_date = data1.goods_price.quota_date
							this.quota_num = data1.goods_price.quota_num
							this.is_limit = data1.goods_price.is_quota
							this.is_section = data1.goods_price.is_section
							this.section_data[0].price = data1.goods_price.ladder1_price
							this.section_data[0].min = data1.goods_price.ladder1_num_min
							this.section_data[0].max = data1.goods_price.ladder1_num_max
							this.section_data[1].price = data1.goods_price.ladder2_price
							this.section_data[1].min = data1.goods_price.ladder2_num_min
							this.section_data[1].max = data1.goods_price.ladder2_num_max
							this.section_data[2].price = data1.goods_price.ladder3_price
							this.section_data[2].min = data1.goods_price.ladder3_num_min
							this.section_data[2].max = data1.goods_price.ladder3_num_max
						}
						this.goods_stock = data1.stock
						this.stock_warning = data1.stock_warning
						this.attribute = data1.attribute
						this.packing = JSON.parse(data1.packing)
						this.params = JSON.parse(data1.param)
						if (data1.parts_goods_ids) {
							this.parts_goods_ids = JSON.parse(data1.parts_goods_ids) //配件商品id
						}
						// 活动标签
						if (data1.is_new == 1) this.partList[0].selected = true
						if (data1.is_hot == 1) this.partList[1].selected = true
						if (data1.is_recommend == 1) this.partList[2].selected = true
						if (data1.is_find == 1) this.partList[3].selected = true
						setTimeout(() => {
							this.goods_body = data1.body
							this.goods_body1 = data1.body
						}, 800)
						let combinedArr = data1.images.split(",").map((id, index) => {
							return {
								id: id,
								path: data1.images_url[index]
							};
						});
						this.goods_bannerImages = combinedArr //轮播图
					}
				});
			},
			handleImageUpload(e) {
				console.log(e, 'e==========');
				this.goods_bannerImages = e;
			},
			handleImageUpload1(e) {
				this.goods_images = e;
			},
			// 提交
			handleSubmit() {
				if (this.isLoading) return;
				uni.hideKeyboard();
				let arr1 = [];
				if (this.goods_bannerImages.length != 0) {
					this.goods_bannerImages.map(item => {
						arr1.push(item.id)
					})
				}
				if (!this.goods_title) return this.$message.info('请输入商品标题');
				if (!this.goods_img) return this.$message.info('请上传商品封面图');
				if (this.goods_bannerImages.length == 0) return this.$message.info('请上传商品轮播图');
				if (!this.goods_body) return this.$message.info('请输入商品详情');
				// if (!this.goods_cid) return this.$message.info('请选择平台分类');
				if (!this.goods_shop_categoryId) return this.$message.info('请选择店铺商品分类');
				// if (!this.goods_sn) return this.$message.info('请输入商品货号');
				if (this.goods_sn&&(!/^[A-Za-z0-9\-\_]+$/.test(this.goods_sn))) return this.$message.info('请输入正确的商品货号');
				
				if (!this.brand_id) return this.$message.info('请选择商品品牌');
				if (!this.cost_price) return this.$message.info('请输入成本价');
				if (this.cost_price.split('.') && this.cost_price.split('.')[1] && this.cost_price.split('.')[1].length > 2) {

					return this.$message.info("请输入正确的成本价");
				}
				if (!this.goods_price) return this.$message.info('请输入售卖价');
				if (this.goods_price.split('.') && this.goods_price.split('.')[1] && this.goods_price.split('.')[1].length > 2) {

					return this.$message.info("请输入正确的售卖价");
				}
				if(Number(this.goods_price) < Number(this.cost_price) ){
					return this.$message.info("售卖价需大于成本价");
				}
				if (!this.goods_stock) return this.$message.info('请输入总库存');
				if (!this.stock_warning) return this.$message.info('请输入库存下限');
				if (Number(this.stock_warning) >= Number(this.goods_stock)) {
					return this.$message.info('总库存要多于库存下限')
				}
				if (!this.attribute) return this.$message.info('请输入商品属性');
				if (!this.min_reserve) return this.$message.info('请输入最小起订量');
				if (this.min_reserve<=0) return this.$message.info('最小起订量需大于0');
				console.log(this.quota_num,'this.quota_num');
				if (this.is_limit) {
					if (this.quota_num<=0) return this.$message.info('限购数量需大于0');
					if (!this.quota_date) return this.$message.info('请选择限购时间');
				}
				console.log(this.section_data, '======this.section_data======');
				let priceOpen = false,
					numOpen = false;
				if (this.is_section == 1) { //开启区间价格
					this.section_data.map((item, index) => {
						// console.log(item,'区间价');
						if (!item.price || ((item.price + '').split('.') && (item.price + '').split('.')[1] && (item.price + '')
								.split('.')[1].length > 2)) {
							priceOpen = true
						}
						if (!item.min || !item.max || (item.min) % 1 > 0 || (item.max) % 1 > 0 || Number(item.min) >= Number(item
								.max)) {
							numOpen = true
						}
						
					})
					if(this.section_data[1].min<=this.section_data[0].max||this.section_data[2].min<=this.section_data[1].max){
						numOpen = true
					}
					if (priceOpen) return this.$message.info('请输入正确的阶梯价格')
					if (numOpen) return this.$message.info('请输入正确的购买数量')
				}
				let is_new = 0,
					is_hot = 0,
					is_recommend = 0,
					is_find = 0;
				this.partList.forEach(item => {
					if (item.selected == false) {
						return this.$message.info('请选择活动标签')
					}
				})
				if (this.partList[0].selected) is_new = 1
				if (this.partList[1].selected) is_hot = 1
				if (this.partList[2].selected) is_recommend = 1
				if (this.partList[3].selected) is_find = 1
				let data = {
					name: this.goods_title,
					thumb: this.goods_imgId, //封面图
					images: arr1.join(',') || '', //轮播图
					shop_price: this.goods_price,
					cost_price: this.cost_price, //成本价
					stock: this.goods_stock,
					body: this.goods_body1,
					video: this.goods_video,
					stock_warning: this.stock_warning, //库存下限
					is_sale: this.is_default ? 1 : 0, //是否上架
					params: JSON.stringify(this.params), //商品参数 json {\"title\":\"重量\", \"value\":\"500G\"}
					packing: JSON.stringify(this.packing), //包装清单 json {\"title\":\"充电器\", \"value\":\"500W\"}
					parts_ids: this.parts_ids.join(','), //配件商品ids
					sn: this.goods_sn, //商品货号
					is_new: is_new, //是否新品
					is_hot: is_hot, //是否爆品
					is_recommend: is_recommend, //是否推荐
					is_find: is_find, //是否发现商品
					min_reserve: this.min_reserve, //最小起订量
					is_quota: this.is_limit ? 1 : 0, //是否限购
					quota_num: this.quota_num, //限购数量
					quota_date: this.quota_date, //限购时间
					is_section: this.is_section ? 1 : 0, //区间价格开关
					section_data: JSON.stringify(this.section_data), //区间价格设置 {\"min\":10,\"max\":50,\"price\":95}
					attribute: this.attribute, //商品属性
					brand_id: this.brand_id,
					goods_shop_category: this.goods_shop_categoryId, //店铺分类
					cid: this.goods_cid||0, //商品分类
					body: this.goods_body,
					parent_goods_id: this.parent_goods_id, //主商品id
				};
				// 添加子商品传 parent_goods_id=主商品ID
				// 编辑商品传id，不传id会自动识别成新加
				if (this.goods_id) {
					data.id = this.goods_id
				}
				this.isLoading = true;
				this.$api.post('/v1/63da15d2538b8', data).then(res => {
						if (res.data.code == 1) {
							this.$message.info("已提交,等待审核");
							// 通知列表页面更新数据
							uni.$emit('addGoodsSuccess');
							setTimeout(() => {
								this.isLoading = false;
								uni.navigateBack();
							}, 800);
						} else {
							this.isLoading = false;
							this.$message.info(res.data.msg);
						}
					})
					.catch(err => {
						this.isLoading = false;
						console.log('err: ' + JSON.stringify(err));
					});
			}
		}
	};
</script>

<style lang="scss" scoped>
	.page {
		min-height: 100vh;
		padding-bottom: 100rpx;
		padding-bottom: calc(100rpx + constant(safe-area-inset-bottom));
		padding-bottom: calc(100rpx + env(safe-area-inset-bottom));
		background-color: #fff;
	}

	.goods-wrap {
		padding: 24rpx 24rpx 34rpx;
	}

	.margin-t-8 {
		margin-top: 8rpx;
	}

	.padding-b-60 {
		padding-bottom: 60rpx;
	}

	.text-111 {
		color: #111111;
	}

	.text-bf {
		color: #bfbfbf;
	}

	.line-20 {
		height: 20rpx;
		width: 100%;
		background: #F8F8F8;
	}

	.after-item-wrap {
		padding: 0rpx 24rpx 30rpx;

		.after-item {

			&.money {
				position: relative;
				height: 122rpx;
				padding-bottom: 44rpx;

				.tips {
					position: absolute;
					left: 0;
					bottom: 20rpx;
				}
			}

		}
	}


	.submit-btn {
		position: fixed;
		bottom: 50rpx;
		bottom: calc(50rpx + constant(safe-area-inset-bottom));
		bottom: calc(50rpx + env(safe-area-inset-bottom));
		left: 0rpx;
		right: 0;
		border-radius: 100rpx;
		width: 95%;
		height: 90rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		color: #ffffff;
		background: $bgtheme;
		font-size: 32rpx;
		font-weight: 500;
		margin: auto;
	}

	.wen {
		width: 702rpx;
		height: 272rpx;
		// border: 1rpx solid #e8e8e8;
		margin-top: 20rpx;
		padding: 24rpx;
		font-size: 28rpx;
		font-weight: 400;
		background: #F8F8F8;
		;
		border-radius: 16rpx;
		position: relative;

		textarea {
			width: 100%;
			height: 85%;
		}

		.tips {
			position: absolute;
			right: 24rpx;
			bottom: 24rpx;
		}
	}

	.img-200 {
		width: 200rpx;
		height: 200rpx;
		border-radius: 16rpx;
	}

	.goods-info {
		flex: 1;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		align-items: flex-start;
		overflow: hidden;

		&>view {
			width: 100%;
		}
	}

	/deep/ .sex-wrap .w-picker-view {
		height: 228rpx;
	}

	/deep/ .w-picker-item {
		position: relative;

		// height: 108rpx!important;
		// line-height: 108rpx!important;
		&::before {
			content: '';
			width: 100%;
			height: 1px;
			background: #eee;
			transform: scaleY(0.5);
			position: absolute;
			top: 0;
			left: 0;
		}

		&::after {
			content: '';
			width: 100%;
			height: 1px;
			background: #eee;
			transform: scaleY(0.5);
			position: absolute;
			bottom: 0;
			left: 0;
		}
	}

	.update-box {
		width: 600rpx;
		background-color: #FFFFFF;

		.title {
			height: 100rpx;
			line-height: 100rpx;
			text-align: center;
			font-size: 32rpx;
			color: #333333;
		}

		.content {
			width: 100%;
			height: 200rpx;
			box-sizing: border-box;
		}

		.foot {
			display: flex;
			text-align: center;
		}
	}

	.container {
		padding: 10px;
	}

	#editor {
		width: 100%;
		height: 300px;
		background-color: #CCCCCC;
	}

	switch::before,
	switch::after {
		content: "";
	}

	// 规则弹窗
	.rule-box {
		width: 100%;
		height: 100%;
		background: #fff;

		.rule-box-title {
			height: 100rpx;
			font-size: 30rpx;
			line-height: 100rpx;
			text-align: center;
			font-weight: bold;
			color: #333;
		}

		.rule-box-content {
			height: calc(100% - 200rpx);
			color: #333;
			padding: 20rpx;
		}

		.rule-box-close {
			height: 100rpx;
			font-size: 32rpx;
			line-height: 100rpx;
			text-align: center;
			color: #333;
		}
	}
</style>